<template>
    <div class="box5">
        <div class="top">
            <p class="title">未来30天游客数量趋势图</p>
            <p class="bg"></p>
        </div>
        <div class="charts" ref="line"></div>
    </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'

let line = ref()

onMounted(() => {
    let mycharts = echarts.init(line.value)
    mycharts.setOption({
        title: {
            text: '游客访问趋势折线图'
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            splitLine: {
                show: false
            },
             //轴线的设置
             axisLine: {
                show: false,
            },
            //刻度
            axisTick: {
                show: false,
            },
        },
        yAxis: {
            splitLine: {
                show: false
            },
            //轴线的设置
            axisLine: {
                show: true,
            },
            //刻度
            axisTick: {
                show: false,
            },
        },
        series: [
            {
                type: 'line',
                data: [0, 700, 40, 500, 66, 666, 200, 800, 600, 666, 100, 789, 200, 260, 500],
                smooth: true,
                //区域填充样式
                areaStyle: {
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [
                            {
                                offset: 0,
                                color: 'orange', // 0% 处的颜色
                            },
                            {
                                offset: 0.2,
                                color: 'orange', // 0% 处的颜色
                            },
                            {
                                offset: 1,
                                color: 'black', // 100% 处的颜色
                            },
                        ],
                        global: false, // 缺省为 false
                    },
                },
            }
        ],
        grid: {
            top: 0,
            bottom: 35,
            right: 10,
            left: 40
        }
    })
})
</script>

<style scoped lang="scss">
.box5 {
    width: 100%;
    height: 100%;
    background: url(../../images/dataScreen-main-lb.png) no-repeat;
    background-size: 100% 100%;
    margin: 0 20px;

    .top {
        margin-left: 20px;

        .title {
            color: white;
            font-size: 20px;
        }

        .bg {
            width: 68px;
            height: 7px;
            background: url(../../images//dataScreen-title.png) no-repeat;
            background-size: 100% 100%;
            margin: 10px 0;
        }
    }

    .charts {
        height: calc(100% - 40px);
    }
}
</style>